home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / +look_here_1st!+ / reader_requests / alienbreed3d2 / oldkey < prev    next >
Text File  |  1997-11-28  |  1KB  |  58 lines

  1.  
  2.  
  3. KInt_Init    ;VBR Assumed $0
  4.         move.l $68.w,OLDKINT
  5.         Move.l    #KInt_Main,$68.w    Install Interrupt 
  6.         And.b    #$3f,$bfe201        Set Timers
  7.         Move.b    #$7f,$bfed01
  8.         Move.b    $bfed01,d0
  9.         Move.b    #$88,$bfed01
  10.         St.b    KInt_CCode        
  11.         Move.b    #$a0,$bfee01        Start Timey Thing
  12.         Rts                And return
  13.  
  14. OLDKINT: dc.l 0
  15.  
  16.  
  17. KInt_Main    
  18.         Movem.l    d0/d1/a0/a1/a6,-(a7)    Stack everything
  19.         Move.w    #8,$dff09a        Temp Disable Int.
  20.         Move.w    $dff01e,d0        Intreqr
  21.         And.w    #8,d0            Mask Out All X^ K_Int
  22.     Beq    KInt_End            Not Keyboard Interrupt
  23.         Lea    $bfed01,a6
  24.         Move.w    #$8,$dff09c        Clear Int.Request
  25.         Move.b    -$100(a6),d0        Move Raw Keyboard value
  26.         Ror.b    #1,d0            Roll to correct
  27.         Not.b    d0            
  28.         Move.b    d0,KInt_CCode        Save Corrected Keycode
  29. .HandShake    Move.b    #8,(a6)
  30.         Move.b    #7,-$900(a6)
  31.         Move.b    #0,-$800(a6)
  32.         Move.b    #0,-$100(a6)
  33.         Move.b    #$d1,$100(a6)        
  34.         Tst.b    (a6)    
  35. .wait        Btst    #0,(a6)
  36.     Beq.s    .wait
  37.         Move.b    #$a0,$100(a6)        
  38.         Move.b    (a6),d0        
  39.         Move.b    #$88,(a6)
  40.         Lea    KeyMap,a1
  41.         Moveq.w    #0,d0
  42.         Move.b    KInt_CCode(pc),d0
  43.     Bmi.s    KInt_KeyUp            neg if up 
  44.  
  45. KInt_KeyDown
  46.         st (a1,d0.w)
  47.         move.b d0,lastpressed
  48.     Bra    KInt_End
  49.  
  50. KInt_KeyUp
  51.         And.w    #$7f,d0            Make code Positive
  52.         clr.b (a1,d0.w)
  53. KInt_End    Movem.l    (a7)+,d0/d1/a0/a1/a6    Unstack Everything
  54.     
  55.         Move.w    #$8008,$dff09a        Re-enable Int.
  56.         Rts
  57.  
  58.